package com.example.mobile2021606177cke0413;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity2 extends AppCompatActivity {

    private TextView tvMainTitle;
    private TextView tvMainTips;
    private TextView tvMainCho;
    private TextView tvMainEuslt;
    private Button btnMainExit;
    private Button btnMainSub;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        initView();
        btnMainExit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog dialog;
                AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity2.this);
                builder.setMessage("提示");
                builder.setMessage("是否退出应用？");
                builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();

                    }
                });
                dialog=builder.create();
                dialog.show();
            }
        });
        btnMainSub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog dialog;

            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        tvMainTips = (TextView) findViewById(R.id.tv_main_tips);
        tvMainCho = (TextView) findViewById(R.id.tv_main_cho);
        tvMainEuslt = (TextView) findViewById(R.id.tv_main_euslt);
        btnMainExit = (Button) findViewById(R.id.btn_main_exit);
        btnMainSub = (Button) findViewById(R.id.btn_main_sub);
    }
}